<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	include("_include.user.judge.php");
	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];
	
	$uid = chkstr(trim($_REQUEST['uid']));
	$aid = chkstr(trim($_REQUEST['aid']));
	if(empty($uid)){
		echo erro("参数错误");
	}
	if(!is_numeric($uid)){
		echo erro("参数错误");
	}
	if(getNewsNums("kboy_user","uid=$uid") <1){
		echo erro("参数错误");
	}

	if(empty($aid)){
		echo erro("参数错误");
	}
	if(!is_numeric($aid)){
		echo erro("参数错误");
	}
	if(getNewsNums("kboy_forum_album","uid=$uid and id=$aid") <1){
		echo erro("参数错误");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的相册_社区_<?= $web_titles ?></title>
<meta name="Keywords" content="我的相册,社区,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<link rel="stylesheet" href="css/jquery.lightbox.css">
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
    <!--banner begin-->
	<? include("_include.forum.banners.php") ?>
    <!--banner end-->
    <!--活动 begin-->
    <div class="sq-wrap">
		<? include("_include.forum.title.php") ?>
        <div class="sq-bd">
			<? include("_include.forum.topnav.php") ?>
            <div class="sq-bd-con">
                <div class="sq-bd-l">
                    <div class="sq-photo-wrap">



					<?php
							if($kboy_userid == $uid){
					?>
                        <div class="travel-hd nb">
                            <div class="title">我的照片</div>
                            <div class="yj-num"><span><?=getNewsNums("kboy_forum_pic","uid=$uid and aid=$aid")?></span>张照片</div>
                            <div class="write-yj"><a href="javascript:void(0);" id="upload-images">上传更多照片</a></div>
                        </div>
                        <div class="photo-editor-operate"><a href="forum_photo.php?uid=<?=$uid?>">返回我的相册</a> | <a href="forum_photo_albumedit.php?uid=<?=$uid?>&aid=<?=$aid?>">编辑相册</a> | <a href="forum_photo_albumaddsave.php?action=del&uid=<?=$uid?>&aid=<?=$aid?>">删除相册</a> | <a href="forum_photo_picedit.php?uid=<?=$uid?>&aid=<?=$aid?>">编辑照片</a></div>
					<?php
							}
					?>



                        <div class="hd-top-nav">
                            <ul>
                                <li class="on"><a>全部照片</a></li>
                                <span class="tips">拍摄日期：<?=date('Y-m-d',strtotime(getClassName("kboy_forum_album","album_shoottime","uid=$uid and id=$aid")))?></span>
                                <div class="hd-total">共计<span><?=getNewsNums("kboy_forum_pic","uid=$uid and aid=$aid")?></span>张照片</div>
                            </ul>
                        </div>
                        <div class="bd-d-content">
                            <ul class="hd-pic-list photo clearfix">
						<?php
								$SQL = "";
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$pagesql = "select * from kboy_forum_pic where uid=$uid and aid=$aid order by id desc";
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_array($news_rows)){
						?>
                                <li>
                                    <a href="<?=$news_rs['photo_pic']?>?lightbox[width]=825&lightbox[height]=447" class="lightbox" rel="list2">
                                        <div class="pic">
                                            <img src="<?=$news_rs['photo_pic']?>" width="336" height="182" alt=""/>
                                        </div>
                                        <div class="info"><?=$news_rs['photo_title']?></div>
                                    </a>
                                </li>
						<?php
								} // while 完毕
						?>
								
								
                            </ul>
						<?php
								if($pagenum > $pagesize){
									echo "<div class=\"pagination\"><ul>";
									$url = "forum_photo_pic.php?uid=$uid&aid=$aid";//当前页面
									pagebar($pagecount, $pageval, 7, $url);
									echo "</ul></div>";
								}
						?>
                        </div>
                    </div>
                </div>
				
				
				
				<? include("_include.forum.right.php") ?>
				
				
				
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
    <script type="text/javascript" src="js/jquery.lightbox.min.js"></script>
	
	<link rel="stylesheet" href="SunbeamEditor/themes/default/default.css" />
	<script charset="utf-8" src="SunbeamEditor/kindeditor.js"></script>
	<script charset="utf-8" src="SunbeamEditor/lang/zh_CN.js"></script>
	
	
    <script type="text/javascript">
        jQuery(document).ready(function($){
            $('.lightbox').lightbox();
        });
		
	KindEditor.ready(function(K) {
	
		/////   点击上传图片
		var editor = K.editor({
			allowFileManager : false
		});

		K('#upload-images').click(function() {
			editor.loadPlugin('multiimage', function() {
				editor.plugin.multiImageDialog({
					clickFn : function(urlList) {
						K.each(urlList, function(i, data) {
						
							$.ajax({ 
								url:'forum_photo_picaddsave.php', 
								type:'post',
								dataType:'html',
								data:'action=add&aid=<?=$aid?>&photo_pic=' + data.url + '&date='+new Date(),
								error: function(){
									//alert('Error loading document'); 
								},success: function(msg){
//									alert(msg);
								} 
							}); 
							
						
						});
						window.location.href='forum_photo_picedit.php?uid=<?=$uid?>&aid=<?=$aid?>&ac=upload';
						editor.hideDialog();
					}
				});
			});
		});
	});
    </script>
</body>
</html>

